package no.rmz.chez.game.moveSelection;

import java.util.Collection;
import java.util.LinkedList;


import no.rmz.chez.game.Move;


/**
 * A bunch of selectors. These represents alleles
 * of a simple gene for chessplaying programs.
 */
public  final class MoveSelectors {

    /**
     *  A selector that will always return the first element.
     */
    public final static Selector<Move> FIRST_SELECTOR = 
        new FirstSelector<>();

    
    /**
     * A selector that will always return the last element.
     */
    public final static Selector<Move> LAST_SELECTOR = 
        new LastSelector<>();

    /**
     * A selecor that will return a random element.
     */
    public final static Selector<Move> RANDOM_SELECTOR =
        new RandomSelector<>();

    /**
     * A selector that will select elements in exponentially
     * less probable manner.
     */
    public final static Selector<Move> EXPONENTIAL_BACKOFF_SELECTOR = 
        new ExponentialBackoffSelector<>();


    /**
     * A set of possible selectors.
     */
    private static final LinkedList<Selector<Move>> ALL_SELECTORS =
        new LinkedList<>();

    /**
     * ALl the selectors.
     * @return All the available selectors.
     */
    public static Collection<Selector<Move>> getAllSelectors() {
        return ALL_SELECTORS;
    }


    /**
     *  Static initialization of the "allSelector" collection.
     */
    static {
        ALL_SELECTORS.add(FIRST_SELECTOR);
        ALL_SELECTORS.add(LAST_SELECTOR);
        ALL_SELECTORS.add(RANDOM_SELECTOR);
        ALL_SELECTORS.add(EXPONENTIAL_BACKOFF_SELECTOR);
    }

}
